﻿using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using System.Globalization;

namespace HttpClientLite.Extensions;

/// <summary>
/// json 转换器
/// </summary>
public class JsonSettings
{
    /// <summary>
    /// 序列化设置
    /// </summary>
    public static JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings
    {
        ContractResolver = new CamelCasePropertyNamesContractResolver(),//序列化首字母小写
        MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
        DateParseHandling = DateParseHandling.None,
        Converters =
            {
                new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeLocal },
            },
    };
}